//
//  WYEditSectionView.m
//  Boss
//
//  Created by admin on 2018/7/5.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYEditSectionView.h"
@interface WYEditSectionView()


@end
@implementation WYEditSectionView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame]) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{
    
    UILabel *label = [[UILabel alloc]init];
    [self addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.centerY.mas_equalTo(self);
    }];
    label.text = @"产品服务";
    self.label = label;
    UIButton *button = [[UIButton alloc]init];
    self.moreBtn = button;
    [self addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-16);
        make.centerY.mas_equalTo(self);
        make.width.height.mas_equalTo(44);
    }];
    
    //[button setTitle:@"add" forState:UIControlStateNormal];
    //[button setBackgroundColor:kColorMainColor];
    
    
    [button setImage:[UIImage imageNamed:@"page_add_icon"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(addAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    UIView *lineView = [[UIView alloc]init];
    self.lineView = lineView;
    [self addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.right.mas_equalTo(0);
        make.left.mas_equalTo(16);
        make.height.mas_equalTo(1);
    }];
    lineView.backgroundColor = [UIColor hexStringToColor:@"#e6e6e6" alpha:1.0];
    
}
-(void)addAction:(UIButton *)btn
{
    if ([self.delegate respondsToSelector:@selector(didSelectAddButton:WithBtn:)]) {
        [self.delegate didSelectAddButton:self.index WithBtn:btn];
    }
}
-(void)setIndex:(NSUInteger)index
{
    _index = index;
    if (index==3) {
        self.label.text = @"公司荣誉";
    }else{
        self.label.text = @"产品服务";
    }
}




@end
